package exercise3;

import java.util.Arrays;
import java.util.Random;

public class Test {

    public static void main4(String[] args) {
        Sort sort = new Sort();
        int[] array = randomArray();
        long start = System.currentTimeMillis();
        sort.heapSort(array);
        long end = System.currentTimeMillis();
        System.out.println("耗时：" + (end - start));
    }

    public static void main3(String[] args) {
        Sort sort = new Sort();
        int[] array = randomArray();
        long start = System.currentTimeMillis();
        sort.shallSort(array);
        long end = System.currentTimeMillis();
        System.out.println("耗时：" + (end - start));
    }

    public static void main(String[] args) {
        Sort sort = new Sort();
        int[] array = randomArray();
        long start = System.currentTimeMillis();
        sort.quickSort(array);
        long end = System.currentTimeMillis();
        System.out.println("耗时：" + (end - start));
    }

    public static void main1(String[] args) {
        Sort sort = new Sort();
        int[] array = randomArray();
        long start = System.currentTimeMillis();
        sort.mergeSort(array);
        long end = System.currentTimeMillis();
        System.out.println("耗时：" + (end - start));
    }


    private static int[] randomArray() {
        int[] array = new int[100000];
        for (int i = 0; i < 100000; i++) {
            int randomNumber = new Random().nextInt(100000);
            array[i] = randomNumber;
        }
        return array;
    }
}